package com.cjj.mybatis.config;

import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

/**
 * @ClassName MybatisPlusConfig
 * @Date 2021/11/03 11:54:56
 * @Created by BrownC_
 * @email ccc-ju@outlook.com
 */
@Configuration
public class MybatisPlusConfig {

//    @Bean
//    public MyInjector myInjector() {
//        return new MyInjector();
//    }

    @Bean
    public GlobalConfig globalConfig() {
        return new GlobalConfig()
                .setBanner(false)
//                .setSqlInjector(myInjector())
            ;
    }

    @Bean
    @Profile({"dev", "local"})
    public PerformanceInterceptor performanceInterceptor() {
        return new PerformanceInterceptor()
            .setFormat(false);
    }

    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }
}

